<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="/system/include/taglib.jsp"%>
<html>
<head>
<base href="${pageScope.basePath }">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>中山市美斯特实业有限公司</title>
<link type="text/css" rel="stylesheet" href="system/css/style.css" />
<script type="text/javascript" src="system/js/public.js"></script>
<link href="system/plugins/validateMyForm/css/plugin.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="system/js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="system/js/verify1.js"></script>
<script type="text/javascript" src="system/plugins/validateMyForm/js/jquery.validateMyForm.1.5.js"></script>
<script type="text/javascript">  
	$(document).ready(function(){ 
		var userRoleIds=$("#currentRoleId").val();
		
		var roleIds=userRoleIds.split(",");
		var role_cbs=$("input[name=roleIds]");
		var i;//形如1,3,4分割成[1,3,4]后记录用户roleId位置
		var j;//记录角色复选框元素位置
		for(i=0;i<roleIds.length;i++){
			for(j=0;j<role_cbs.length;j++){
				if(roleIds[i]==role_cbs[j].value){
					role_cbs[j].checked=true;
				}
			}			
		}
	    $("#form1").validateMyForm(); 
		$(".email").keypress(function(){
		    $(".email").next().fadeOut();
		});
	}); 
	

</script>  
</head>
<body>
<div class="main">
	<div class="position">当前位置: <a href="/sysadm/desktop.jsp">桌 面</a> → 修改部门</div>
	<div class="mainbody">
		<div class="operate_info">操作说明：带 * 号必填</div>
		<div class="table">
		<mytag:View table="com.zhongkai.model.config.User" id="${param.userId}" name="user"></mytag:View>
		<form id="form1" action="system/config/user_manage_modify.do" method="post">
			<input name="userId" type="hidden" value="${user.userId}"/>
			<input type="hidden" id="currentDepartmentId" value="${user.departmentId}">
			<input id="currentRoleId" name="currentRoleId" type="hidden" value="${user.roleId}"/><!-- 用来选中checkbox -->
			<table width="100%" border="0" cellpadding="1" cellspacing="1" class="table_form">
					<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
						<td align="right">用户编号：</td>
						<td><input id="userIdentifier" name="userIdentifier" value="${user.userIdentifier}" class="required" onblur="verify('system/ajax/user.do?method=findIdentifier',this)"/>&nbsp;<span style="color:red">*</span></td>
					</tr>
					<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
						<td align="right">密码：</td>
						<td><input name="userPassword" type="password"" value="${user.userPassword}" class="required"/>&nbsp;<span style="color:red">*</span> </td>
					</tr>
					<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
						<td align="right">昵称：</td>
						<td><input name="userNickname" value="${user.userNickname}" /></td>
					</tr>
					<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
						<td align="right">邮箱：</td>
						<td>
							<input type="text" name="userEmail" value="${user.userEmail}" class="email">							
						</td>
					</tr>
					<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
						<td align="right">部门：</td>
						<td>
							<select id="departmentId" name="departmentId" class="required">							
							<mytag:List table="Department" name="departmentList"></mytag:List>
							<logic:iterate id="department" name="departmentList">
								<c:if test="${user!=null&&department.departmentId!=null }">
									<c:if test="${user.departmentId==department.departmentId }">
										<option value="${department.departmentId}" selected>${department.departmentName}</option>
									</c:if>
									<c:if test="${user.departmentId!=department.departmentId }">
										<option value="${department.departmentId}" >${department.departmentName}</option>
									</c:if>
								</c:if>
							</logic:iterate>
							</select>
							<span style="color:red">*</span> 
						</td>
					</tr>
					<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
						<td align="right">角色：</td>
						<td>
							<mytag:List table="Role" name="roleList"></mytag:List>
							<logic:iterate id="role" name="roleList">
								<c:if test="${user!=null&&role.roleId!=null }">									
									<input name="roleIds" type="checkbox" value="${role.roleId}"><label>${role.roleName}</label>
								</c:if>
							</logic:iterate>
							<span style="color:red">*</span>
						</td>
					</tr>
					<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
						<td align="right">是否启用：</td>
						<td>
							<c:if test="${user.userSwitch==1}">
								<input name="userSwitch" type="radio" value="1" checked />是
								<input name="userSwitch" type="radio" value="0" />否
							
							</c:if>
							<c:if test="${user.userSwitch==0}">
								<input name="userSwitch" type="radio" value="1" />是
								<input name="userSwitch" type="radio" value="0" checked />否
							
							</c:if>
							
						</td>
					</tr>
					<tr>
						<td colspan="2" class="form_button" style="padding-top:10px;">
							<input type="submit" value="更新" />
							<input type="reset" value="重置" />
							<input type="button" value="返回" onClick="location.href='${pageScope.basePath }system/config/user_manage_list.jsp'" />
						</td>
					</tr>
			</table>
			</form>
		</div>
	</div>
</div>
</body>
</html>
